package demo;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class DeleteSignture {
	public static WebDriver driver = null;
	public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Java\\chromedriver\\chromedriver.exe");
     driver = new ChromeDriver();
     driver.get("http://qzone.qq.com/");
     waitForElement(By.id("u"));
     waitForElement(By.id("p"));
     waitForElement(By.id("subbtn"));
     driver.findElement(By.id("u")).sendKeys("398733146");
     driver.findElement(By.id("p")).sendKeys("wang1987YANG");
    driver.findElement(By.id("subbtn")).click();
    driver.manage().timeouts().implicitlyWait(4,TimeUnit.SECONDS);
    driver.findElement(By.id("subbtn")).click();

	}
	
	  public static  void waitForElement(final By by){
			WebDriverWait wait = new WebDriverWait(driver,60);
			wait.until(new ExpectedCondition<WebElement>(){
				@Override
				public WebElement apply(WebDriver d) {
					return d.findElement(by);
				}
			});		
		}

}
